         //----------------------------------setting------------------------------//
var lecturessetting = {  
        /*    check: {  
                enable: true,
            },  
              */
            data: {  
                simpleData: {  
                    enable: true,//如果设置为 true，请务必设置 setting.data.simpleData 内的其他参数: idKey / pIdKey / rootPId，并且让数据满足父子关系。  
                    idKey: "id",  
                    pIdKey: "pId",  
                    rootPId: 0  
                }  
            },  
          /*  edit: {
        		enable: true
        	},    */            
              
         view: {  
                showLine: true,//显示连接线  
                showIcon: true,//显示节点图片  
            },             
            async: {
            	type: "get",
            	contentType: "application/json",
        		enable: true,
        		url: "lecturestree",
        		autoParam: ["id", "name"]
        	},
        	callback: {
        		beforeEditName: zTreeBeforeEditName,
        		beforeRename: zTreeBeforeRename,
        		onRename: zTreeOnRename,
    	  		onClick: zTreeOnClick
        	}
        };  
function zTreeOnClick(event, treeId, treeNode) {
		var iframe= document.getElementById("lecturesiframe");
		if(treeNode.id!=null)
			{
		$("#lecturesiframe", window.parent.document).attr("src", "lecturesdata?nodeid="+treeNode.id);}
	};
function zTreeBeforeEditName(treeId, treeNode) {
	return !treeNode.isParent;
}
function zTreeBeforeRename(treeId, treeNode, newName, isCancel) {
	return newName.length > 5;
}
function zTreeOnRename(event, treeId, treeNode, isCancel) {
	alert(treeNode.tId + ", " + treeNode.name);
}

//----------------------------------treeNodes树节点------------------------------//
var treeNodes = new Array();  
$(function(){    
$.ajax({  
  url: "lecturestree",  
  type:'get',  
  async: false ,  
  error: function () {//请求失败处理函数  
      alert('请求失败');  
  }, 
  success: function(data){  
  var msg = eval('(' + data + ')');  
                
  $.each(msg,function(i,item){  
  treeNodes.push(new Node(item.tid,item.pid,item.name,item.open));  
      });  
      $.fn.zTree.init($("#tree"), lecturessetting, treeNodes);
          }  
      });  
});  
  function Node(id,pid,name,open){  
      this.id=id;  
      this.pId=pid;  
      this.name=name;  
      this.open=open;                              
  }  
  //----------------------------------treeObj------------------------------//
  //更新节点
  var treeObj = $.fn.zTree.getZTreeObj("tree");
  var nodes = treeObj.getNodes();
  if (nodes.length>0) {
	  alert("1");
  	nodes[0].name = "test";
  	treeObj.updateNode(nodes[0]);
  }